<?php

class Obj_DBTable_Image extends Zend_Db_Table_Abstract
{
    protected $_name = 'object_files';
    protected $_primary = 'ID';
   
    public function getImages($id, $main_only = false) {
    	$select = $this->select()->from($this)->order('Main DESC')->order('date')->where('ParentID = ?', (int) $id);
    	if($main_only) $select->where('Main = 1');
    	return $this->fetchAll($select)->toArray();
    }
     
    public function getImage($id) {
    	$select = $this->select()->from($this)->where('ID = ?', (int) $id);
    	$res = $this->fetchRow($select);
    	if ($res) {
    		return $res->toArray();
    	}
    	return false;
    }

}

